package com.itjeffrey.autocode.bo;

import lombok.*;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.springframework.security.core.GrantedAuthority;

import java.io.Serializable;
import java.util.Collection;

/**
 * 登录信息BO
 */
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class LoginInfoBO implements Serializable{

    private static final long serialVersionUID = 1L;

    private String loginName;

    private String loginPwd;

    private Collection<? extends GrantedAuthority> authorities;

    /**
     * ReflectionToStringBuilder.toString实现对象打印输出，兼容排查某些字段(如loginPwd)
     *
     *  MULTI_LINE_STYLE 每一行一个字段
     *  SHORT_PREFIX_STYLE 不换行，用逗号分隔
     *
     *   return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE){
     *       @Override
     *       protected boolean accept(Field field) {
     *           return !field.getName().equals("loginPwd");
     *       }
     *   }.toString();
     *
     * @return
     */
    @Override
    public String toString() {
        return ReflectionToStringBuilder.toStringExclude(this, "loginPwd");
    }

}
